package com.test.vote.service;

import com.test.vote.mapper.BattleDao;
import com.test.vote.pojo.Battle;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class battleService {
    @Resource
    BattleDao battleDao;

    //根据比赛id查找battle
    public List<Battle> selectBattle(int matchId) {
        return battleDao.selectBattle(matchId);
    }

    //根据battleId查找battle
    public Battle selectBattleById(int battleId) {
        return battleDao.selectByPrimaryKey(battleId);
    }

    //添加一场battle
    public int addBattle(Battle battle) {
        return battleDao.insert(battle);
    }

    //改变对战状态，battleStatus
    public int updateBattleStatus(Battle battle) {
        return battleDao.updateByPrimaryKeySelective(battle);
    }
}
